<?php

function submit_new_custom_post()
{
echo "inserting;";
$title="";
$content="";

global $current_user;
get_currentuserinfo();

die;exit;
	  
$my_post = array(
     'post_title' => $title,
     'post_content' => $content,
     'post_status' => 'pending',
     'post_author' => $current_user->ID
  );
  
print_r($my_post);
}
?>
<script type="text/javascript">
jQuery(function($){
	$('.target').click(function () {
		
		var data = {
		action: 'my_action',
		whatever: 1234
	};

	// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
	// 
	// ajaxurl+"?action=my_action&whatever=1234"
 	jQuery.get("<?PHP bloginfo("template_url"); ?>/lib/ajax.php", function(response) {
		alert('Got this from the server: ' + response);
	});
});
});
</script>
<div class="target">
<button class="click">Click me</button>
<input type="hidden" value="77" class="post_id" id="id" />
</div>
<?PHP
echo "add action";
add_action('wp_ajax_my_action', 'submit_new_custom_post');
add_action('wp_ajax_nopriv_my_action', 'submit_new_custom_post');
?>